package com.ydcycloud.variety.controller.common;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ydcycloud.base.bean.CommonResult;
import com.ydcycloud.base.enums.CommonEnums;
import com.ydcycloud.variety.service.SlideShowService;
import com.ydcycloud.sys.controller.BaseWapController;

/**
 * 首页
 * */

@Controller
@RequestMapping("/common/index")
public class IndexCommonController extends BaseWapController {

	@Resource
	private SlideShowService slideShowService;

	/**
	 * 获取轮播图
	 * */
	@RequestMapping(value = "/slideShowList", method = RequestMethod.POST)
	public @ResponseBody
	CommonResult getSlideShow() {
		CommonResult r = new CommonResult();
		try {

			List<Map<String, Object>> getSlideShow = slideShowService
					.getSlideShow();

			if (getSlideShow == null) {
				r.setData("");
			} else {
				r.setData(getSlideShow);
			}
			commonEnums = CommonEnums.SUCCESS;// 300 成功
		} catch (Exception e) {
			commonEnums = CommonEnums.SYSTEM_ERROR;// 301 系统错误
			e.printStackTrace();
		} finally {
			r.setMessage(commonEnums.getLabel());
			r.setStatus(commonEnums.getValue());
		}
		return r;
	}

}

